<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>按Enter键切换</title>
	</head>

	<body>
		<p>用户姓名：<input type="text" /></p>
		<p>电子邮箱：<input type="text" /></p>
		<p>手机号码：<input type="text" /></p>
		<script>
			var inputs = document.getElementsByTagName('input')
			for(var i = 0; i < inputs.length; i++) {
				inputs[i].onkeydown = function() {
					if(event.keyCode == 13) {
						for(var k = 0; k < inputs.length; k++) {
							if(inputs[k] == this) {
								var index = k + 1 >= inputs.length ? 0 : k + 1;
								inputs[index].focus();
							}
						}
					}
				};
			}
		</script>
	</body>

</html>